package com.starinside.wp.repository.cookbook;

import com.starinside.wp.domain.cookbook.RecipeShow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

public interface RecipeShowRepository extends JpaRepository<RecipeShow, Long>, JpaSpecificationExecutor<RecipeShow> {
    // selectRecipeShowByTimeAndSchoolId
    // select  *  from ybb_recipe_show  where recipe_date = #{recipeDate} and school_id = #{schoolId,jdbcType=INTEGER}
    RecipeShow findFirstByRecipeDateAndAreaId(Date date, String areaId);

    //
    //delete from ybb_recipe_show  where recipe_date = #{recipeDate} and school_id = #{schoolId,jdbcType=INTEGER}
    @Transactional
    int deleteByRecipeDateAndAreaId(Date date, String areaId);

}